package com.mymusic.wangyiMusicBackend.service;

import com.mymusic.wangyiMusicBackend.bean.Music;
import com.mymusic.wangyiMusicBackend.bean.MySongList;
import com.mymusic.wangyiMusicBackend.bean.PlayList;
import com.mymusic.wangyiMusicBackend.bean.ResultUtil;
import com.mymusic.wangyiMusicBackend.mapper.MusicMapper;
import com.mymusic.wangyiMusicBackend.mapper.MySongListMapper;
import com.mymusic.wangyiMusicBackend.mapper.PlayListMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.SQLIntegrityConstraintViolationException;
import java.util.List;
@Service
public class InfomationService {
    @Autowired
    private PlayListMapper playListMapper;

    @Autowired
    MusicMapper musicMapper;

    @Autowired
    MySongListMapper mySongListMapper;

    public List<PlayList> findAllPlayList() {
        return playListMapper.findAll();
    }

    public PlayList findPlayListById(int id) {
        return playListMapper.findById(id);
    }

    public int insertPlayListByMusicId(int id) {return playListMapper.insertById(id);}

    public int deletePlayListById(int id) {return playListMapper.deleteById(id);}


    public List<Music> findAllMusic (){
        return musicMapper.findAll();
    }

    public Music findMusicById (int id){
        return musicMapper.findById(id);
    }


    public List<MySongList> findAllMySongList() {return mySongListMapper.findAll(); }
}

